-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rust, python): treat null columns as zero in sum_horizontal
#13880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
If all columns are Null, return Null
I don't think this is correct. Null should just be treated as the identity always.
@stinodego In this case I was referring to the actual Null data type, as opposed to all values being null i.e. df = pl.DataFrame([
pl.Series("A", [None, None, None], pl.Null),
pl.Series("B", [None, None, None], pl.Null),
pl.Series("C", [None, None, None], pl.Null),
]) If you replaced Thanks! |
Ah, I hadn't understood that part. Then it's probably fine! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #13113
I have also changed the behaviour of single columns sums. This seems more consistent to multi-column sums. Example:
As reference, when summing multiple columns
sum_horizontal("A", "B") = [10, 3, 3, 0]
Before
sum_horizontal("A") = [5, None, 3, None]
After
sum_horizontal("A") = [5, 0, 3, 0]